import 'package:flutter/material.dart';
import 'package:flutterdemo/common/calc.dart';
import 'package:flutterdemo/components/icon_right.dart';
import 'package:flutterdemo/components/my_appbar.dart';

class Setting extends StatefulWidget {
  Setting({Key? key}) : super(key: key);

  @override
  _SettingState createState() => _SettingState();
}

class _SettingState extends State<Setting> {


  Widget _itemW(String name,onTab) {
    return Ink(
      color: Colors.white,
      child: InkWell(
        onTap: () {
          onTab();
        },
        child: Container(
          padding: EdgeInsets.all(Calc.width(30)),
          child: Center(
            child: Text(name),
          ),
        ),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    Calc.init(context);
    return Scaffold(
      backgroundColor: Color.fromRGBO(233, 233, 233, 1),
      appBar: MyAppBar().getAppBar("设置"),
      body: ListView(
        physics: BouncingScrollPhysics(),
        children: [
          IconRight(name: "账号与安全"),
          SizedBox(
            height: Calc.width(20),
          ),
          IconRight(name: "关于移门管家"),
          Divider(
            height: 0,
          ),
          IconRight(name: "主题选择"),
          SizedBox(
            height: Calc.width(20),
          ),
          IconRight(name: "帮助与反馈"),
          SizedBox(
            height: Calc.width(20),
          ),
          _itemW("切换账号",(){
            Navigator.pushNamedAndRemoveUntil(context, "login", (route) => false);
          }),
          SizedBox(
            height: Calc.width(20),
          ),
          _itemW("退出",(){
            Navigator.pushNamedAndRemoveUntil(context, "login", (route) => false);
          }),
        ],
      ),
    );
  }
}
